<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <body>
        <ui:composition template="./../template/main.xhtml">
            <ui:define name="content">
                  <h1 class="title ui-widget-header ui-corner-all ">Báo Cáo Doanh Thu</h1>
                <h:form>
                    <h:panelGrid columns="2" styleClass="my-panel-grid">
                        <!-- Month -->
                        <p:outputLabel value="Tháng: "/>
                        <p:selectOneMenu value="#{revenueReportController.selectedMonth}">
                            <f:selectItem itemLabel="1" itemValue="1"/>
                            <f:selectItem itemLabel="2" itemValue="2"/>
                            <f:selectItem itemLabel="3" itemValue="3"/>
                            <f:selectItem itemLabel="4" itemValue="4"/>
                            <f:selectItem itemLabel="5" itemValue="5"/>
                            <f:selectItem itemLabel="6" itemValue="6"/>
                            <f:selectItem itemLabel="7" itemValue="7"/>
                            <f:selectItem itemLabel="8" itemValue="8"/>
                            <f:selectItem itemLabel="9" itemValue="9"/>
                            <f:selectItem itemLabel="10" itemValue="10"/>
                            <f:selectItem itemLabel="11" itemValue="11"/>
                            <f:selectItem itemLabel="12" itemValue="12"/>
                        </p:selectOneMenu>
                        <!-- Year -->
                        <p:outputLabel value="Năm: "/>
                        <p:selectOneMenu value="#{revenueReportController.selectedYear}">                            
                            <f:selectItem itemLabel="2013" itemValue="2013"/>
                            <f:selectItem itemLabel="2014" itemValue="2014"/>
                            <f:selectItem itemLabel="2015" itemValue="2015"/>
                        </p:selectOneMenu>
                        <!-- Actions -->
                        <p:commandButton id="btnShow" actionListener="#{revenueReportController.updateRevenueExpenditureByStoreList()}" update=":revenueExpenditureForm" icon="ui-icon-check" title="Xem" value="Xem"/>
                    </h:panelGrid>
                </h:form>                
                <p:dataTable style="text-align: center" id="revenueExpenditureForm" var="revenueExpenditure" value="#{revenueReportController.revenueExpenditureByStoreList}" 
                             emptyMessage="Không có dữ liệu">
                    <!-- Store -->
                    <p:column headerText="Cửa hàng">
                        <p:outputLabel value="#{revenueExpenditure.store}"/>
                    </p:column>
                    <!-- Date -->
                    <p:column headerText="Ngày">
                        <p:outputLabel value="#{revenueExpenditure.date}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </p:outputLabel>
                    </p:column>
                    <!-- Revenue -->
                    <p:column headerText="Thu">
                        <p:outputLabel value="#{revenueExpenditure.revenue}">
                            <f:convertNumber integerOnly="true"/>
                        </p:outputLabel>
                    </p:column>
                    <!-- Expenditure -->
                    <p:column headerText="Chi">
                        <p:outputLabel value="#{revenueExpenditure.expenditure}">
                            <f:convertNumber integerOnly="true"/>
                        </p:outputLabel>
                    </p:column>
                    <!-- Expenditure -->
                    <p:column headerText="Doanh thu">
                        <p:outputLabel value="#{revenueExpenditure.profit}">
                            <f:convertNumber integerOnly="true"/>
                        </p:outputLabel>
                    </p:column>
                </p:dataTable>
            </ui:define>
        </ui:composition>
    </body>
</html>